<{include file="../common/iframe_header.tpl"}>
<link href="//unpkg.com/layui@2.11.5/dist/css/layui.css" rel="stylesheet">
<script src="//unpkg.com/layui@2.11.5/dist/layui.js"></script>
<div class="pad_10" style="margin-top: 40px;">
    <div class="table-list">
        <div class="common-form">
            <button type="button" class="layui-btn layui-btn-normal" id="uploadify">选择文件</button>
            <button type="button" class="layui-btn" id="ID-upload-demo-action">开始上传</button>
            <div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="demo-filter-progress">
                <div class="layui-progress-bar" lay-percent="0%"></div>
            </div>
            <div>
                请选择zip文件包，包内文件为所有网点此问卷下题目对标的附件，包内文件名格式为<br/><b>网点编号-题目编号-题目序号</b><br/>
                在线播放支持格式如下：图片jpg,jpeg,png,gif 音频视频mp3,wav,m4a,ogg,mp4,flv,fla
            </div>
            </form>
        </div>
    </div>
    <br/>
    <div class="table-list">
        <table width="100%">
            <thead>
            <tr>
                <th>ZIP文件名</th>
                <th>更新时间</th>
                <th>处理结果</th>
                <th>状态</th>
            </tr>
            </thead>
            <tbody>
            <{foreach $list as $key => $val}>
                <tr onMouseOver="this.className = 'tr2'" onMouseOut="this.className = 'tr1'" class="tr1" id="question_<{$val.question_id}>">
                    <td><{$val.zip_name}></td>
                    <td><{$val.update_time}></td>
                    <td><{$val.remark|msubstr:30}></td>
                    <td><{if $val.is_dispose==1}>未处理<{else}>已处理<{/if}></td>
                </tr>
                <{/foreach}>
            </tbody>
        </table>

        <div style="float:right;"><{$page}></div>
    </DIV>
</div>
<script type="text/javascript">
    var project_email = "超大文件上传请联系项目邮箱<{$project_info.email}>,或者拆分多个文件上传";
    layui.use(function(){
        var upload = layui.upload;
        var element = layui.element;
        var layer = layui.layer;
        // 渲染
        upload.render({
            data:{'question_id' : '<{$question_id}>','project_id':'<{$project_info.project_id}>','bank_id':'<{$project_info.bank_id}>'},
            dataType :'text',
            elem: '#uploadify',
            url: '/webadmin/attach/zip',
            auto: false,
            field:'upfile',
            size:600000,
            accept:'file',
            acceptMime:'application/zip',
            // multiple: true,
            bindAction: '#ID-upload-demo-action',
            progress: function(n, elem, res, index){
                var percent = n + '%' // 获取进度百分比
                element.progress('demo-filter-progress', percent); // 可配合 layui 进度条元素使用
            },
            done: function(res, index, upload){
                console.log(res);
                var obj = eval('(' + res + ')');
                if (obj.state == 'SUCCESS') {
                    layer.confirm('上传成功',{
                        btn: ['确定'] //按钮
                    }, function(){
                        window.parent.location.reload();
                    });


                } else {
                    layer.msg(obj.error);
                }
            }
        });
    });

</script>
<{include file="../common/footer.tpl"}>